package com.extsci.monitor;

import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.io.IOException;


/**
 * @author ccoke
 */
@SpringBootApplication
@Log4j
public class MonitorApplication {

	public static void main(String[] args) {
		// 获取程序上下文
		ApplicationContext applicationContext = SpringApplication.run(MonitorApplication.class, args);
		EmailMonitor emailMonitor =(EmailMonitor)applicationContext.getBean("emailMonitor");
		try {
			emailMonitor.start();
		} catch (IOException e) {
			e.printStackTrace();
			log.info("启动失败:" + e.getMessage());
		}
	}
}
